@extends('default.layouts.adminPublic')
@section('title', '网站内容管理')
@section('content')
<!--导航开始-->
<div class="crumb_warp">
    <i class="fa fa-home"></i> <a href="{{url('admin')}}">首页</a> &raquo; 网站内容
</div>
<!--导航结束-->

<!--列表开始-->

    <div class="result_wrap">
        <div class="result_title">
            <h3>网站内容列表</h3>
            @include('flash::message')
        </div>
        <!--快捷导航 开始-->
        <div class="result_content">
            <div class="short_wrap">
                <a href="{{ url('admin/webcontent/create') }}"><i class="fa fa-plus"></i>添加网站内容</a><em>{{ session('message') }}</em>
            </div>
        </div>
        <!--快捷导航 结束-->
    </div>

    <div class="result_wrap">
        <div class="result_content">
            <ul class="list_tab make">
                <li class="title border_buttom">
                    <span class="first">序号</span>
                    <span class="second ">标题</span>
                    <span class="third">标签</span>
                    <span class="five">更新时间</span>
                    <span class="six">操作</span>
                </li>
                @foreach($webContent as $k => $v)
                    <li class="@if($k % 2 == 0) saith_bg @else double_bg @endif border_buttom">
                        <span class="first">{{ $v->descid }}</span>
                        <span class="second">{{ msubstr($v->title,0,15) }}</span>
                        <span class="third">{{ $v->sign }}</span>
                        <span class="five">{{ $v->updated_at }}</span>
                        <span class="six">
                            <a href="{{ url('admin/webcontent/'.$v->id.'/edit') }}">修改</a>
                            <a  onclick="delNews(this,'{{ $v->id }}','{{ $v->title }}')">删除</a>
                        </span>
                    </li>
                @endforeach
            </ul>
        </div>
    </div>
<div class="page_list">
    <div>{!! $webContent->links() !!}</div>
</div>
<!--列表结束-->
<script type="text/javascript">
    //删除资讯
    function delNews(othis,id,title) {
        layer.confirm('您确定要删除这条网站信息吗？', {
            btn: ['确定', '取消'] //按钮
        }, function () {
            $.post("{{url('admin/webcontent')}}/" + id, {
                '_method': 'delete',
                '_token': "{{csrf_token()}}",
                'title': title
            }, function (data) {
                if (data.status == 0) {
                    layer.msg(data.msg, {icon: 6, time: 1500});
                    location.href="{{ url('/admin/webcontent') }}";
                } else {
                    layer.msg(data.msg, {icon: 5, time: 1500});
                }
            });
        });
    }
</script>
@endsection